package cac.fenjian.resource.msaccmat.api;

import cac.fenjian.resource.MsAccMat.dto.MsAccMatDTO;
import cac.fenjian.resource.common.RestUtil;
import com.cac.dme.adapter.rest.client.RestClient;
import com.cac.dme.adapter.rest.msg.ResponseMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program test-curd
 * @description 对外接口
 * @author: LSL
 * @create: 2022-08-08-09-57
 **/
@RestController
@Component
@RequestMapping("/msAccMatApi")
public class MsAccMatApi {
    private static final String SERVICE_CODE="xdCommonData";
    private static final String BASE_PATH = "/MsAccMat";

    @Autowired
    private RestUtil restUtil;

    @Autowired
    private RestClient restClient;

    /**
     * 新增接受物料信息
     * @param msAccMatDTO
     * @return
     */
    @RequestMapping("/insertMsAccMatDTO")
    public ResponseMsg<String> insertMsAccMatDTO(@RequestBody MsAccMatDTO msAccMatDTO){
        String url = BASE_PATH+"/insert/v1";
        restUtil.setRestClient(restClient);
        return restUtil.callServicePost(url, SERVICE_CODE, msAccMatDTO, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
    }

}
